Performing a manual Man-in-the-Middle attack using the command-line tool arpspoof. 🕵️♂️
Yesterday, I used ettercap for ARP poisoning. It was simple and mostly automated.
But today, I performed the same attack manually using the command-line tool arpspoof. Here’s how I did it:
Before starting, we must enable IP forwarding.
If IP forwarding is disabled, traffic from the victim will reach the attacker and stop there.
Traffic from the router will also stop at the attacker.
But we want the victim and router to stay connected so they don’t notice anything.
That’s how we perform a proper MITM attack.
Run:
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
Split the terminal.
In the first terminal, run:
sudo arpspoof -i eth0 -t <victim_IP> <router_IP>
-i → interface-t → targetThis command tells the victim:
"Hey, I am the router."
Now, the victim’s ARP table will store our MAC address as the router.
In the second terminal, run the same command but reverse the IPs:
sudo arpspoof -i eth0 -t <router_IP> <victim_IP>
This tells the router:
"Hey, I am the victim."
Now you are in the middle.
Open Wireshark and observe the traffic — especially ARP packets.
You will see how trust in ARP makes this attack possible.
Because ARP has no authentication, it can be spoofed easily.
Here are the two main mitigations I learned:
Instead of dynamically learning MAC addresses, you manually enter them in the ARP table.
This prevents fake ARP replies from changing the mapping.
arp -a
arp -s <IP> <MAC>
Example:
arp -s 192.168.10.7 e9-60-dd-a6-f8-cc
Note: Windows uses MAC addresses with dashes (-).
arp -a
You will now see the entry as static.
arp -d <IP>
Add a static ARP entry:
sudo ip neigh add <IP> lladdr <MAC> dev eth0 nud permanent
Example:
sudo ip neigh add 192.168.10.8 lladdr 00:0f:2a:55:1a:7c dev eth0 nud permanent
eth0 may be different on your system. Check using ip a.nud permanent makes it static.To delete:
sudo ip neigh del <IP> dev eth0
Note – Limitations
Static ARP entries are cleared after reboot.
This can be solved using a start-up script.It works fine in small home networks,
but it is not scalable for enterprise environments.
DAI is used in enterprise networks.
It works like this:
It uses the DHCP Snooping binding table.
This table stores trusted information:
If an ARP packet does not match this table, it is dropped.
ARP was designed for trust.
Modern networks are not built on trust anymore.